/*
 *  Class name: PlayerArrangeableTableHandler.java
 *  Version: 1.0
 *  Date: 26.2.2014
 */
package cz.muni.fi.pa165.soccergamesarchive.managedbeans.entity.handlers.table;

import cz.muni.fi.pa165.soccergamesarchive.businesslayer.services.PlayerServiceBeanLocal;
import cz.muni.fi.pa165.soccergamesarchive.datamodels.entity.PlayerDataModel;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.Dependent;
import javax.inject.Named;
import org.richfaces.component.SortOrder;

/**
 *
 * @author Michal Ďuriš
 */
@Named(value = "playerArrangeableTableHandler")
@Dependent
public class PlayerArrangeableTableHandler extends ArrangeableEntityTableHandler
        implements Serializable {

    private static final long serialVersionUID = 1L;

    @EJB
    private PlayerServiceBeanLocal playerServiceBean;

    private PlayerDataModel playerDataModel;

    /**
     * Creates a new instance of PlayerArrangeableTableHandler
     */
    public PlayerArrangeableTableHandler() {
    }

    @PostConstruct
    public void init() {
        playerDataModel = new PlayerDataModel(playerServiceBean);

        sortOrders.put("firstName", SortOrder.unsorted);
        sortOrders.put("lastName", SortOrder.unsorted);
        sortOrders.put("team", SortOrder.unsorted);
        sortOrders.put("shirtNumber", SortOrder.unsorted);
    }

    @Override
    public Object getDataModel() {
        return playerDataModel;
    }

}
